﻿/***************************************
 功能验证
2023-09-08
 */

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace PingYou.Console
{
    public class Verficate
    {
        #region 验证号码是否有效
        private static bool VerTelValid(string tel)
        {
            return System.Text.RegularExpressions.Regex.IsMatch(tel, @"^[1]+[3-9]+\d{9}");
        }
        #endregion

        #region 手机号码验证
        public static bool IsTelRight(params string[] tels)
        {
            List<string> myTelList = new List<string>();
            bool isRight = true;
            foreach (string tel in tels)
            {
                isRight = VerTelValid(tel);
                if (!isRight)
                {
                    PYCommon.WriteMsg(tel);
                    myTelList.Add(tel);
                    isRight = false;
                }

            }
            if (myTelList.Count > 0)
            {

                return false;
            }
            return true;
        }
        #endregion
    }
}
